package com.ruoyi.common.config;

import io.minio.MinioClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.annotation.Resource;

/**
 * @author wuxuan
 * @date 2023-02-15 13:55
 */
@Configuration
public class MinioClientConfig {
    @Resource
    private MinIoStorageProperty minIoStorageProperty;

    @Bean
    public MinioClient minioClient() {
        return MinioClient
                .builder()
                .endpoint(minIoStorageProperty.getUrl(),minIoStorageProperty.getPort(),false)
                .credentials(minIoStorageProperty.getAccessKey(), minIoStorageProperty.getSecretKey())
                .build();
    }
}
